/**
 * @author Jeson
 * @date:2015-12-18 下午02:02:10
 * @version :3.0
 *
 */
package com.ctvit.wsservice.basedata.service;

import java.util.List;

import com.ctvit.framework.dao.Condition;
import com.ctvit.framework.service.BaseService;
import com.ctvit.wsservice.basedata.domain.ZcdmTProglist;
import com.ctvit.wsservice.basedata.domain.ZcdmTProrec;

@SuppressWarnings("serial")
public class ZcdmTProrecService extends BaseService {
	/**
	 * 
	 * @ps: 节目播出单插入数据库(主表和子表)
	 * @param zcdmTProrec
	 * @return -1 参数异常 0插入成功 1更新失败
	 */
	public int saveZcdmTProrec(ZcdmTProrec zcdmTProrec, List<ZcdmTProglist> list) {
		if (zcdmTProrec == null && list == null)
			return -1; // 参数异常!
		Condition condition = new Condition();
		condition.add("zProRecCd", zcdmTProrec.getZProRecCd());
		if (genericDao.updateByCondition(zcdmTProrec, null, condition) == 0) {
			genericDao.insert(zcdmTProrec);
			genericDao.batchInsert(list);
			return 0; // 插入成功!
		} else {
			return 1; // 信息已存在!
		}
	}
}
